﻿@{
	ViewBag.Title = @Resources.Menu_MyProfile;
}
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
	<tr>
		<td class="b1">
			<div>
				<p><img src="~/images/icon_06.png" align="absmiddle" />&nbsp;@Resources.Menu_UserCenter<span>&nbsp;>>&nbsp;</span>@Resources.Menu_MyProfile
			</div>
		</td>
	</tr>
</table>
<form id="frmDetail" method="post" enctype="multipart/form-data" action="@Url.Action(nameof(ProfileEditController.Edit), nameof(ProfileEditController).GetControllerName())">
	@Html.AntiForgeryToken()
	<h3 class="tit01" style="text-align:left;">&nbsp;&nbsp;@Resources.MyProfile</h3>
	<table width="100%" height="100%" id="tblDetail" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.UserName：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtUserName" class="easyui-textbox" style="height:27px; width:300px;" disabled>
			</td>
			<td style="text-align: center;" class="w1 c2" rowspan="5">
				<img id="headImg" style="width:150px; height:200px;" />
			</td>
			<td style="text-align: center;" class="w2 c2" rowspan="5">
				<input id="txtHeadImg" name="headImgFile" class="easyui-filebox" style="height:27px; width:75px;" data-options="prompt:'@Resources.ImportImg', accept:'image/jpeg,image/png,image/gif', buttonText:'@Resources.UploadHeadImg'" />
				<br /><span id="spHeadImg">150*200</span><input type="hidden" id="hidHeadImg" name="HeadImgFilePath" />
				<br /><a href="javascript:void(0)" id="aHeadImg" class="easyui-linkbutton" onclick='$("#txtHeadImg").filebox("clear"); $("#hidHeadImg").val("");'>@Resources.Clear</a>
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Mail：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtMail" class="easyui-textbox" style="height:27px; width:300px;" disabled>
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Password：</td>
			<td style="text-align: left;" class="w2 c2">
				<input type="password" id="txtPasswordStar" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[8,30]']" />
				<input id="txtPassword" name="Password" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[8,30]']" />
					<a onclick="changeType(0);" id="showPasswordPic"> <img src="~/images/open1.png" style="float:right; height:20px; width:20px;"></a>
					<a onclick="changeType(1);" id="hidePasswordPic"> <img src="~/images/close1.png" style="float:right; height:20px; width:20px;"></a>
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.Language：</td>
				<td style="text-align: left;" class="w2 c2">
					<select id="ddlLanguage" name="Language" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,panelHeight:'auto'">
						<option value="@ConstValues.Language.Cn">@Resources.LanguageCN</option>
						<option value="@ConstValues.Language.En">@Resources.LanguageEN</option>
					</select>
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.FullName：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="txtFullName" name="FullName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.FamilyName：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="txtFamilyName" name="FamilyName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']">
				</td>
				<td style="text-align: right;" class="w1 c3">@Resources.Gender：</td>
				<td style="text-align: left;" class="w2 c2">
					<select id="ddlGender" name="GenderStr" class="easyui-combobox" style="height:27px; width:300px;" data-options="editable:false,required:true,panelHeight:'auto'">
						<option value="@ConstValues.Gender.男">@Resources.Male</option>
						<option value="@ConstValues.Gender.女">@Resources.Female</option>
					</select>
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.FirstName：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="txtFirstName" name="FirstName" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
				</td>
				<td style="text-align: right;" class="w1 c3">@Resources.Birthday：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="dateBirthday" name="Birthday" class="easyui-datebox" style="height:27px; width:300px;" data-options="editable:false" />
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.Title：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="ddlCall" name="Call" class="easyui-combobox" style="height:27px; width:300px;" />
				</td>
				<td style="text-align: right;" class="w1 c3">@Resources.Degree：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="ddlDegree" name="Degree" class="easyui-combobox" style="height:27px; width:300px;">
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.Career：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="ddlCareer" name="Career" class="easyui-combogrid" style="height:27px; width:300px;" />
				</td>
				<td style="text-align: right;" class="w1 c3">@Resources.OcisCodeField：</td>
				<td style="text-align: left;" class="w2 c2">
					<input id="ddlOcisCode" name="OcisCode" class="easyui-combogrid" style="height:27px; width:300px;" />
				</td>
			</tr>
			<tr>
				<td style="text-align: right;" class="w1 c3">@Resources.CV：</td>
				<td style="text-align: left;" class="w2 c2" colspan="3">
					<input id="txtCV" name="CV" class="easyui-textbox" style="height:50px; width:900px;" data-options="multiline:true, validType:['length[1,1000]']" />
				</td>
			</tr>
		</table>
	<h3 class="tit01" style="text-align:left;">&nbsp;&nbsp;@Resources.MyContact</h3>
	<table width="100%" height="100%" id="tblContact" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Affiliation：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtAffiliation" name="Affiliation" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
			</td>
			<td style="text-align: right;" class="w1 c3">@Resources.Country：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="ddlCountry" name="Country" class="easyui-combobox" style="height:27px; width:300px;">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Department：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtDepartment" name="Department" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']">
			</td>
			<td style="text-align: right;" class="w1 c3">@Resources.State：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtState" name="State" class="easyui-textbox" style="height:27px; width:300px;">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Address：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtAddress" name="Address" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
			</td>
			<td style="text-align: right;" class="w1 c3">@Resources.City：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtCity" name="City" class="easyui-textbox" style="height:27px; width:300px;">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.ZipCode：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtZipCode" name="ZipCode" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
			</td>
			<td style="text-align: right;" class="w1 c3">@Resources.Telephone：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtTelephone" name="Telephone" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Mobile：</td>
			<td style="text-align: left;" class="w2 c2">
				<input id="txtMobile" name="Mobile" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
			</td>
			<td style="text-align: right;" class="w1 c3"></td>
			<td style="text-align: left;" class="w2 c2"></td>
		</tr>
	</table>
	<h3 class="tit01" style="text-align:left;">&nbsp;&nbsp;@Resources.MyInvoice</h3>
	<table width="100%" height="100%" id="tblInvoice" cellpadding="0" cellspacing="1" border="0" class="tastyle01">
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.InvoiceTitle：</td>
			<td style="text-align: left;" class="c2">
				<input id="txtInvoiceTitle" name="InvoiceTitle" class="easyui-combobox" style="height:27px; width:900px;" data-options="validType:['length[1,100]']">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.TaxNum：</td>
			<td style="text-align: left;" class="c2">
				<input id="txtTaxNum" name="taxNum" class="easyui-textbox" style="height:27px; width:900px;" data-options="validType:['length[1,100]']">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.AddressAndTel：</td>
			<td style="text-align: left;" class="c2">
				<input id="txtAddressAndTel" name="AddressAndTel" class="easyui-textbox" style="height:27px; width:900px;" data-options="validType:['length[1,200]']">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.Bank：</td>
			<td style="text-align: left;" class="c2">
				<input id="txtBank" name="Bank" class="easyui-textbox" style="height:27px; width:900px;" data-options="validType:['length[1,100]']">
			</td>
		</tr>
		<tr>
			<td style="text-align: right;" class="w1 c3">@Resources.BankAccount：</td>
			<td style="text-align: left;" class="c2">
				<input id="txtBankAccount" name="BankAccount" class="easyui-textbox" style="height:27px; width:900px;" data-options="validType:['length[1,100]']">
			</td>
		</tr>
	</table>
	<input id="hidModify" type="hidden" />
</form>
<div class="btnDiv">
	<input type="button" id="btnFixInformation" class="lbtn" onclick="fixInformation();" value="@Resources.FixENInformation" />&nbsp;&nbsp;
	<input type="button" class="gbtn" id="btnModify" onclick="editData();" value="@Resources.Edit">&nbsp;&nbsp;
	<input type="button" class="rbtn" onclick="window.location.reload();" value="@Resources.Cancel">
</div>
<div id="fixInformationWindow" class="easyui-window"
	title="@Resources.FixENInformation" data-options="closed:true,minimizable:false,maximizable:false,iconCls:'icon-save'"
	style="width:1200px; display:none;">
	<div class="main">
		<div class="box clearfix">
			<h3 id="fixInformationWindowTitle" class="tit01"></h3>
			<form id="frmDetailEN" method="post">
				@Html.AntiForgeryToken()
				<table style="width:100%;height:100%" id="tblDetailEN" class="tastyle01">
					<tr>
						<td style="text-align: right;" class="w1 c1"><span id="spFamilyName">@Resources.FamilyName：</span></td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFamilyNameEN" name="FamilyNameEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']">
						</td>
						<td style="text-align: right;" class="w1 c1"><span id="spFirstName">@Resources.FirstName：</span></td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtFirstNameEN" name="FirstNameEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3"><span id="spTitle">@Resources.Title：</span></td>
						<td style="text-align: left;" class="w2 c4">
							<input id="ddlCallEN" name="CallEN" class="easyui-combobox" style="height:27px; width:300px;" data-options="required:true,validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c3"><span id="spAddress">@Resources.Address：</span></td>
						<td style="text-align: left;" class="w2 c4">
							<input id="txtAddressEN" name="AddressEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,200]']" />
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c1"><span id="spAffiliation">@Resources.Affiliation：</span></td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtAffiliationEN" name="AffiliationEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']" />
						</td>
						<td style="text-align: right;" class="w1 c1"><span id="spDepartment">@Resources.Department：</span></td>
						<td style="text-align: left;" class="w2 c2">
							<input id="txtDepartmentEN" name="DepartmentEN" class="easyui-textbox" style="height:27px; width:300px;" data-options="validType:['length[1,100]']">
						</td>
					</tr>
					<tr>
						<td style="text-align: right;" class="w1 c3"><span id="spCV">@Resources.CV：</span></td>
						<td style="text-align: left;" class="w2 c4" colspan="3">
							<input id="txtCVEN" name="CVEN" class="easyui-textbox" style="height:50px; width:900px;" data-options="multiline:true, validType:['length[1,1000]']" />
						</td>
					</tr>
				</table>
			</form>
			<div class="btnDiv">
				<input type="button" class="gbtn" onclick="saveFixData();" value="@Resources.Submit" />&nbsp;&nbsp;
				<input type="button" class="rbtn" onclick="$('#fixInformationWindow').window('close');" value="@Resources.Cancel" />
			</div>
		</div>
	</div>
</div>
@section Scripts {
<script>
	$(function () {
		var language = "@Request.Cookies["_culture"].Value";

		if (language == "@ConstValues.Language.Cn") {
			$("#btnFixInformation").val("完善英文信息");
		} else {
			$("#btnFixInformation").val("完善中文信息");
		}

		var url = "@Url.Action(nameof(ProfileEditController.GetData),
				nameof(ProfileEditController).GetControllerName())";
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxSuccessResult") {
				$("#txtUserName").textbox("setValue", data.data.userName);
				$("#txtMail").textbox("setValue", data.data.mail);
				$("#txtPasswordStar").textbox("setValue", data.data.password);
				$("#txtPassword").textbox("setValue", data.data.password);
				$("#ddlLanguage").combobox("setValue", data.data.language);
				$("#headImg").attr("src", "@Url.Action(nameof(UtilityController.HeadImg),
						nameof(UtilityController).GetControllerName())" + "/" + data.data.id);
				$("#txtHeadImg").filebox("clear");
				$("#txtHeadImg").filebox("setText", data.data.headImg);
				$("#txtHeadImg").filebox({
					width: ((language == "@ConstValues.Language.En") ? 65 : 75),
				});
				$("#hidHeadImg").val(data.data.headImg);

				$("#txtFullName").textbox("setValue", data.data.fullName);
				$("#txtFamilyName").textbox("setValue", data.data.familyName);
				$("#txtFirstName").textbox("setValue", data.data.firstName);
				$("#ddlGender").combobox("setValue", data.data.gender ? "@ConstValues.Gender.男" : "@ConstValues.Gender.女");
				$("#dateBirthday").datebox("setValue", data.data.birthday);
				$("#txtCV").textbox("setValue", data.data.cv);

				$("#txtAffiliation").textbox("setValue", data.data.affiliation);
				$("#txtDepartment").textbox("setValue", data.data.department);
				$("#txtAddress").textbox("setValue", data.data.address);
				$("#txtZipCode").textbox("setValue", data.data.zipCode);
				$("#txtTelephone").textbox("setValue", data.data.telephone);
				$("#txtMobile").textbox("setValue", data.data.mobile);

				language = data.data.language;

				$("#ddlCountry").combobox({
					url: "@Url.Action(nameof(UtilityController.GetCountry), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
				});
				$("#ddlCountry").combobox("setValue", data.data.country);
				$("#txtState").textbox("setValue", data.data.state);
				$("#txtCity").textbox("setValue", data.data.city);

				$("#ddlCall").combobox({
					url: "@Url.Action(nameof(UtilityController.GetCall), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
				});
				$("#ddlCall").combobox("setValue", data.data.call);

				$("#ddlDegree").combobox({
					url: "@Url.Action(nameof(UtilityController.GetDegree), nameof(UtilityController).GetControllerName())",
					valueField: "id",
					textField: "name",
					required: true,
					editable: false,
					panelHeight: "auto",
				});
				$("#ddlDegree").combobox("setValue", data.data.degree);

				$("#ddlCareer").combogrid({
					url: "@Url.Action(nameof(UtilityController.GetCareer), nameof(UtilityController).GetControllerName())",
					panelWidth: ((language == "@ConstValues.Language.En") ? 450 : 300),
					idField: "id",
					textField: "name",
					multiple: true,
					editable: false,
					required: true,
					columns: [[
						{ field: "chk", align: "center", checkbox: true },
						{ field: "name", title: "@Resources.Career", width: ((language == "@ConstValues.Language.En") ? 400 : 250) },
					]],
					onHidePanel: function () { }
				});
				$("#ddlCareer").combogrid("setValues", data.data.career);

				$("#ddlOcisCode").combogrid({
					url: "@Url.Action(nameof(UtilityController.GetOCIS), nameof(UtilityController).GetControllerName())" + "?conferenceId=0",
					panelWidth: 510,
					panelHeight: 300,
					idField: "id",
					textField: "name",
					multiple: true,
					editable: false,
					required: true,
					columns: [[
						{ field: "chk", align: "center", checkbox: true },
						{ field: "name", title: "@Resources.MajorField" },
					]],
					onHidePanel: function () { }
				});
				$("#ddlOcisCode").combogrid("setValues", data.data.ocisCode);

				var orgCount = 0;
				$("#txtInvoiceTitle").combobox({
					url: "@Url.Action(nameof(UtilityController.GetInvoiceInfo), nameof(UtilityController).GetControllerName())",
					valueField: "invoiceTitle",
					textField: "invoiceTitle",
					panelHeight: "auto",
					hasDownArrow: false,
					onLoadSuccess: function (data) {
						orgCount = data.length;
					},
					onChange: function (n, o) {
						$("#txtTaxNum").textbox("setValue", "");
						$("#txtAddressAndTel").textbox("setValue", "");
						$("#txtBank").textbox("setValue", "");
						$("#txtBankAccount").textbox("setValue", "");
					},
					onSelect: function (rec) {
						$("#txtTaxNum").textbox("setValue", rec.taxNum);
						$("#txtAddressAndTel").textbox("setValue", rec.addressAndTel);
						$("#txtBank").textbox("setValue", rec.bank);
						$("#txtBankAccount").textbox("setValue", rec.bankAccount);
					},
					onShowPanel: function () {
						if (orgCount < 10) {
							$(this).combobox("panel").height("auto");
						} else {
							$(this).combobox("panel").height(200);
						}
					},
					onHidePanel: function () { }
				});

				$("#txtInvoiceTitle").combobox("setValue", data.data.invoiceTitle);
				$("#txtInvoiceTitle").combobox("setText", data.data.invoiceTitle);
				$("#txtTaxNum").textbox("setValue", data.data.taxNum);
				$("#txtAddressAndTel").textbox("setValue", data.data.addressAndTel);
				$("#txtBank").textbox("setValue", data.data.bank);
				$("#txtBankAccount").textbox("setValue", data.data.bankAccount);

				$("#hidModify").val(0);
				$("#btnModify").val("@Resources.Edit");

				$("#tblDetail input").attr("disabled", true);
				$("#tblDetail span").attr("disabled", true);
				$("#tblContact input").attr("disabled", true);
				$("#tblContact span").attr("disabled", true);
				$("#tblInvoice input").attr("disabled", true);
				$("#tblInvoice span").attr("disabled", true);

				$("#txtHeadImg").next().hide();
				$("#spHeadImg").hide();
				$("#aHeadImg").hide();

				$("#txtPasswordStar").next().show();
				$("#txtPassword").next().hide();
				$("#showPasswordPic").show();
				$("#hidePasswordPic").hide();
				$("#ddlLanguage").combobox("readonly", true);
				$("#txtFullName").textbox({ disabled: true });
				$("#txtFamilyName").textbox({ disabled: true });
				$("#txtFirstName").textbox({ disabled: true });
				$("#ddlLanguage").combobox("readonly", true);
				$("#dateBirthday").combo("readonly", true);
				$("#ddlCall").combobox("readonly", true);
				$("#ddlDegree").combobox("readonly", true);
				$("#ddlCareer").combobox("readonly", true);
				$("#ddlOcisCode").combobox("readonly", true);
				$("#txtCV").textbox({ disabled: true });

				$("#txtAffiliation").textbox({ disabled: true });
				$("#txtDepartment").textbox({ disabled: true });
				$("#txtAddress").textbox({ disabled: true });
				$("#txtZipCode").textbox({ disabled: true });
				$("#ddlCountry").combobox("readonly", true);
				$("#txtState").textbox({ disabled: true });
				$("#txtCity").textbox({ disabled: true });
				$("#txtTelephone").textbox({ disabled: true });
				$("#txtMobile").textbox({ disabled: true });

				$("#txtInvoiceTitle").combobox("readonly", true);
				$("#txtTaxNum").textbox({ disabled: true });
				$("#txtAddressAndTel").textbox({ disabled: true });
				$("#txtBank").textbox({ disabled: true });
				$("#txtBankAccount").textbox({ disabled: true });
			};
		});

		$("#fixInformationWindow").window({
			onOpen: function () {
				$(this).scrollTop(0);
			},
			top: ($(window).height() - 600) * 0.5
		});
	})

	function editData() {
		if ($("#hidModify").val() == 0) {
			unlockForm();
			$("#txtPasswordStar").next().hide();
			$("#txtPassword").next().show();
			$("#showPasswordPic").hide();
			$("#hidePasswordPic").hide();
			return;
		}

		saveData();
	}

	function unlockForm() {
		$("#hidModify").val(1);
		$("#btnModify").val("@Resources.Submit");

		$("#tblDetail input").attr("disabled", false);
		$("#tblDetail span").attr("disabled", false);
		$("#tblContact input").attr("disabled", false);
		$("#tblContact span").attr("disabled", false);
		$("#tblInvoice input").attr("disabled", false);
		$("#tblInvoice span").attr("disabled", false);

		$("#txtHeadImg").next().show();
		$("#spHeadImg").show();
		$("#aHeadImg").show();

		$("#ddlLanguage").combobox("readonly", false);
		$("#txtFullName").textbox({ disabled: false });
		$("#txtFamilyName").textbox({ disabled: false });
		$("#txtFirstName").textbox({ disabled: false });
		$("#ddlLanguage").combobox("readonly", false);
		$("#dateBirthday").combo("readonly", false);
		$("#ddlCall").combobox("readonly", false);
		$("#ddlDegree").combobox("readonly", false);
		$("#ddlCareer").combobox("readonly", false);
		$("#ddlOcisCode").combobox("readonly", false);
		$("#txtCV").textbox({ disabled: false });

		$("#txtAffiliation").textbox({ disabled: false });
		$("#txtDepartment").textbox({ disabled: false });
		$("#txtAddress").textbox({ disabled: false });
		$("#txtZipCode").textbox({ disabled: false });
		$("#ddlCountry").combobox("readonly", false);
		$("#txtState").textbox({ disabled: false });
		$("#txtCity").textbox({ disabled: false });
		$("#txtTelephone").textbox({ disabled: false });
		$("#txtMobile").textbox({ disabled: false });

		$("#txtInvoiceTitle").combobox("readonly", false);
		$("#txtTaxNum").textbox({ disabled: false });
		$("#txtAddressAndTel").textbox({ disabled: false });
		$("#txtBank").textbox({ disabled: false });
		$("#txtBankAccount").textbox({ disabled: false });
	}

	function changeType(type) {
		if (type == 0) {
			$("#txtPassword").textbox("setValue", $("#txtPasswordStar").textbox("getValue"));
			$("#txtPasswordStar").next().hide();
			$("#txtPassword").next().show();
			$("#showPasswordPic").hide();
			$("#hidePasswordPic").show();
		} else {
			$("#txtPasswordStar").textbox("setValue", $("#txtPassword").textbox("getValue"));
			$("#txtPasswordStar").next().show();
			$("#txtPassword").next().hide();
			$("#showPasswordPic").show();
			$("#hidePasswordPic").hide();
		}
	}

	function saveData() {
		var imgEnd = $("#txtHeadImg").filebox("getText");
		var validPassword = $("#txtPassword").textbox("getValue");
		//if ($("#txtPassword").is(":hidden")) {
			//$("#txtPassword").textbox("setValue", $("#txtPasswordStar").textbox("getValue"));
		//}
		var isValid = $("#frmDetail").form("validate");
		if (isValid) {
			if (imgEnd != "" && !/\.(gif|jpg|jpeg|png|GIF|JPG|PNG|JPEG)$/.test(imgEnd)) {
				common.showError("@Resources.MsgImgType");
				return false;
			} else if (!/^[A-Za-z0-9]+$/.test(validPassword)) {
				common.showError("@Resources.MsgPasswordVaildate");
				return false;
			} else {
				$.messager.confirm("@Resources.Submit", "@Resources.CfmSave", function (r) {
					if (r) {
						var loading = layer.load(0, {
							shade: [0.4, "#fff"]
						});

						$("#frmDetail").form({
							iframe: false,
							success: function (data) { }
						});

						$("#frmDetail").form("submit", {
							onSubmit: function (param) {
								param.random = Math.random();
							},
							success: function (data) {
								layer.close(loading);
								data = JSON.parse(data);
								if (data.result == "@ConstValues.AjaxFailResult") {
									common.showError(data.message);
								} else {
									common.showSuccess(data.message, true);
									window.location.reload();
								}
							}
						});
					}
				})
			}
		}
	};

	function fixInformation() {
		var language = "@Request.Cookies["_culture"].Value";
		if (language == "@ConstValues.Language.Cn") {
			$("#fixInformationWindowTitle").text("完善英文信息");
			$("#fixInformationWindow").panel({ title: "完善英文信息" });
			$("#spFamilyName").html("Last Name/Family Name：");
			$("#spFirstName").html("First Name：");
			$("#spTitle").html("Title：");
			$("#spAddress").html("Address：");
			$("#spAffiliation").html("Affiliation/Organization：");
			$("#spDepartment").html("Department：");
			$("#spCV").html("CV：");
		} else {
			$("#fixInformationWindowTitle").text("完善中文信息");
			$("#fixInformationWindow").panel({ title: "完善中文信息" });
			$("#spFamilyName").html("姓：");
			$("#spFirstName").html("名：");
			$("#spTitle").html("称呼：");
			$("#spAddress").html("地址：");
			$("#spAffiliation").html("单位：");
			$("#spDepartment").html("部门：");
			$("#spCV").html("个人简介：");
		}

		$("#ddlCallEN").combobox({
			url: "@Url.Action(nameof(UtilityController.GetCallEn), nameof(UtilityController).GetControllerName())",
			valueField: "id",
			textField: "name",
			editable: false,
			panelHeight: "auto",
			onBeforeLoad: function (param) {
				param.language = language == "@ConstValues.Language.Cn" ? "@ConstValues.Language.En" : "@ConstValues.Language.Cn";
			}
		});

		var url = "@Url.Action(nameof(ProfileEditController.GetEnData), nameof(ProfileEditController).GetControllerName())";
		$.get(url, null, function (data, textStatus, jqXHR) {
			if (data.result == "@ConstValues.AjaxSuccessResult") {
				$("#txtFamilyNameEN").textbox("setValue", data.data.familyName);
				$("#txtFirstNameEN").textbox("setValue", data.data.firstName);
				$("#ddlCallEN").combobox("setValue", data.data.call);
				$("#txtAddressEN").textbox("setValue", data.data.address);
				$("#txtAffiliationEN").textbox("setValue", data.data.affiliation);
				$("#txtDepartmentEN").textbox("setValue", data.data.department);
				$("#txtCVEN").textbox("setValue", data.data.cv);
			}
		});

		$("#fixInformationWindow").window("open", {
			top: ($(window).height() - 600) * 0.5
		});
		$(this).scrollTop(0);
	}

	function saveFixData() {
		var isValid = $("#frmDetailEN").form("validate");
		if (isValid) {
			$.messager.confirm("@Resources.Submit", "@Resources.CfmSave", function (r) {
				if (r) {
					var loading = layer.load(0, {
						shade: [0.4, "#fff"]
					});
					$.post("@Url.Action(nameof(ProfileEditController.EditEn), nameof(ProfileEditController).GetControllerName())",
						$("#frmDetailEN").serialize(),
						function (data, textStatus, jqXHR) {
							layer.close(loading);
							if (data.result == "@ConstValues.AjaxFailResult") {
								common.showError(data.message);
								$("#fixInformationWindow").window("close");
							} else {
								common.showSuccess(data.message, true);
								$("#fixInformationWindow").window("close");
							}
						}
					);
				}
			})
		}
	}
</script>
}